package com.sg.service.biz.pbff.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.pbff.req.*;
import com.sg.dto.biz.pbff.res.*;
import com.sg.service.biz.pbff.HostTypeService;
import com.wicket.okrframework.integration.AppSceneService;
import com.wicket.okrframework.integration.HostTypeService;
import com.wicket.okrframework.integration.InductionRecordService;
import com.wicket.okrframework.integration.dto.*;
import com.sg.common.exception.Assert;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class HostTypeServiceImpl implements HostTypeService {

    @Resource
    com.sg.service.biz.framework.HostTypeService fwBaseHostTypeClient;
    @Resource
    com.sg.service.biz.framework.InductionRecordService fwBaseInductionRecordClient;
    @Resource
    com.sg.service.biz.framework.AppSceneService fwBaseAppSceneClient;
    @Resource
    private RedisUtil redisUtil;

    /**
     * B1-1查询宿主类型列表（平台）[844]
     * gen by moon at 11/4/2022, 11:01:05 PM
     */
    @Trace(operationName = "B1-1查询宿主类型列表（平台）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryHostTypeListRespDto queryHostTypeList(BffQueryHostTypeListReqDto reqDto) {


        QueryHostTypeListRespDto queryHostTypeListRespDto_1 = null;
        BatchQueryInductionRecordComRespDto batchQueryInductionRecordComRespDto_1 = null;
//步骤0: D1-1查询宿主类型列表 - queryHostTypeList
        QueryHostTypeListRespDto queryHostTypeListRespDto = null;
        QueryHostTypeListReqDto queryHostTypeListReqDto = new QueryHostTypeListReqDto();
        if (reqDto != null) {
            queryHostTypeListReqDto.setHostTypeName(reqDto.getHostTypeName());//SimpleFieldAssign//sourceId:22412_1
            queryHostTypeListReqDto.setCategoryTypeCode(reqDto.getCategoryTypeCode());//SimpleFieldAssign//sourceId:22413_1
            queryHostTypeListReqDto.setIsSystem(reqDto.getIsSystem());//SimpleFieldAssign//sourceId:22414_1
            queryHostTypeListReqDto.setPlatformData(reqDto.getPlatformData());//SimpleFieldAssign//sourceId:133926_1
            queryHostTypeListReqDto.setIsArchive(reqDto.getIsArchive());//SimpleFieldAssign//sourceId:22415_1
            queryHostTypeListReqDto.setCreateInductionId(reqDto.getCreateInductionId());//SimpleFieldAssign//sourceId:34299_1
        }

        /*D1-1查询宿主类型列表[839]   */

        queryHostTypeListRespDto = fwBaseHostTypeClient.queryHostTypeList(queryHostTypeListReqDto).getData();


        queryHostTypeListRespDto_1 = queryHostTypeListRespDto;

//步骤1: D1-3批量查询就职记录(管理)(公共) - batchQueryInductionRecordCom
        BatchQueryInductionRecordComRespDto batchQueryInductionRecordComRespDto = null;
        if (queryHostTypeListRespDto != null) {
            BatchQueryInductionRecordComReqDto batchQueryInductionRecordComReqDto = new BatchQueryInductionRecordComReqDto();
            if (queryHostTypeListRespDto != null) {
                batchQueryInductionRecordComReqDto.setOrgInductionRecordList(queryHostTypeListRespDto.getHostTypeList().stream().map(item -> item.getOperationInductionId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:420282_1
            }

            /*D1-3批量查询就职记录(管理)(公共)[5024]   */

            batchQueryInductionRecordComRespDto = fwBaseInductionRecordClient.batchQueryInductionRecordCom(batchQueryInductionRecordComReqDto).getData();


            batchQueryInductionRecordComRespDto_1 = batchQueryInductionRecordComRespDto;
        }

        BffQueryHostTypeListRespDto retData = new BffQueryHostTypeListRespDto();
        //数据集融合  MoreListToOneSource
        if (queryHostTypeListRespDto_1 != null && !CollectionUtil.isEmpty(queryHostTypeListRespDto_1.getHostTypeList())) {
            for (HostTypeDto hostTypeDto : queryHostTypeListRespDto_1.getHostTypeList()) {
                BffHostTypeDto retElm = new BffHostTypeDto();
                if (queryHostTypeListRespDto_1 != null) {
                    retElm.setHostTypeId(hostTypeDto.getHostTypeId());//SimpleFieldAssign//sourceId:8658_2
                    retElm.setHostTypeCode(hostTypeDto.getHostTypeCode());//SimpleFieldAssign//sourceId:8659_2
                    retElm.setHostTypeName(hostTypeDto.getHostTypeName());//SimpleFieldAssign//sourceId:8660_2
                    retElm.setSubjectLifeCycle(hostTypeDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:8661_2
                    retElm.setOperationInductionId(hostTypeDto.getOperationInductionId());//SimpleFieldAssign//sourceId:14943_2
                    retElm.setOperateTime(hostTypeDto.getOperateTime());//SimpleFieldAssign//sourceId:8663_2
                }
                retData.getHostTypeList().add(retElm);
                if (batchQueryInductionRecordComRespDto_1 != null) {
                    for (OrgInductionRecordDto orgInductionRecordDto : batchQueryInductionRecordComRespDto_1.getOrgInductionRecordList()) {
                        if (orgInductionRecordDto.getInductionRecordId().equals(hostTypeDto.getOperationInductionId())) {
                            if (batchQueryInductionRecordComRespDto_1 != null) {
                                retElm.setUserId(orgInductionRecordDto.getUserId());//SimpleFieldAssign//sourceId:115348_2
                                retElm.setUserFace(orgInductionRecordDto.getUserFace());//SimpleFieldAssign//sourceId:115344_2
                                retElm.setIdCardName(orgInductionRecordDto.getIdCardName());//SimpleFieldAssign//sourceId:115345_2
                                retElm.setNickName(orgInductionRecordDto.getNickName());//SimpleFieldAssign//sourceId:115346_2
                            }
                        }
                    }
                }

            }
        }//sourceId:22423_1


        retData.setPageNum(queryHostTypeListRespDto.getPageNum());
        retData.setPageSize(queryHostTypeListRespDto.getPageSize());
        retData.setTotal(queryHostTypeListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryHostTypeListRespDto.getTotalNum()) / Double.valueOf(queryHostTypeListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B1-1存档宿主类型推荐到业务场景（平台）[1444]
     * gen by moon at 8/10/2022, 3:43:40 AM
     */
    @Trace(operationName = "B1-1存档宿主类型推荐到业务场景（平台）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffArchiveHostTypeBizScnRespDto archiveHostTypeBizScn(BffArchiveHostTypeBizScnReqDto reqDto) {


        //步骤0: D1-1存档宿主类型推荐的业务场景	 - archiveArchiveHostTypeBizScn
        ArchiveArchiveHostTypeBizScnRespDto archiveArchiveHostTypeBizScnRespDto = null;
        ArchiveArchiveHostTypeBizScnReqDto archiveArchiveHostTypeBizScnReqDto = new ArchiveArchiveHostTypeBizScnReqDto();
        if (reqDto != null) {
            archiveArchiveHostTypeBizScnReqDto.setRecommendHostTypeRecordId(reqDto.getRecommendHostTypeRecordId());//sourceId:34481_1
            archiveArchiveHostTypeBizScnReqDto.setHostTypeId(reqDto.getHostTypeId());//sourceId:34482_1
        }

        /*D1-1存档宿主类型推荐的业务场景	[1447]   */
        Assert.isNull(archiveArchiveHostTypeBizScnReqDto.getRecommendHostTypeRecordId(), "B1-1存档宿主类型推荐到业务场景（平台）-D1-1存档宿主类型推荐的业务场景	-推荐宿主类型记录ID不能为空", false);
        Assert.isNull(archiveArchiveHostTypeBizScnReqDto.getHostTypeId(), "B1-1存档宿主类型推荐到业务场景（平台）-D1-1存档宿主类型推荐的业务场景	-宿主类型ID不能为空", false);
        archiveArchiveHostTypeBizScnRespDto = fwBaseHostTypeClient.archiveArchiveHostTypeBizScn(archiveArchiveHostTypeBizScnReqDto).getData();


        BffArchiveHostTypeBizScnRespDto retData = new BffArchiveHostTypeBizScnRespDto();


        return retData;
    }

    /**
     * B1-1发布宿主类型推荐到业务场景（平台）[1443]
     * gen by moon at 8/10/2022, 3:43:36 AM
     */
    @Trace(operationName = "B1-1发布宿主类型推荐到业务场景（平台）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffReleaseHostTypeBizScnRespDto releaseHostTypeBizScn(BffReleaseHostTypeBizScnReqDto reqDto) {


        //步骤0: D1-1发布宿主类型推荐到业务场景 - releaseHostTypeBizScn
        ReleaseHostTypeBizScnRespDto releaseHostTypeBizScnRespDto = null;
        ReleaseHostTypeBizScnReqDto releaseHostTypeBizScnReqDto = new ReleaseHostTypeBizScnReqDto();
        if (reqDto != null) {
            releaseHostTypeBizScnReqDto.setRecommendHostTypeRecordId(reqDto.getRecommendHostTypeRecordId());//sourceId:34514_1
            releaseHostTypeBizScnReqDto.setHostTypeId(reqDto.getHostTypeId());//sourceId:34515_1
        }

        /*D1-1发布宿主类型推荐到业务场景[1138]   */
        Assert.isNull(releaseHostTypeBizScnReqDto.getRecommendHostTypeRecordId(), "B1-1发布宿主类型推荐到业务场景（平台）-D1-1发布宿主类型推荐到业务场景-推荐宿主类型记录ID不能为空", false);
        Assert.isNull(releaseHostTypeBizScnReqDto.getHostTypeId(), "B1-1发布宿主类型推荐到业务场景（平台）-D1-1发布宿主类型推荐到业务场景-宿主类型ID不能为空", false);
        releaseHostTypeBizScnRespDto = fwBaseHostTypeClient.releaseHostTypeBizScn(releaseHostTypeBizScnReqDto).getData();


        BffReleaseHostTypeBizScnRespDto retData = new BffReleaseHostTypeBizScnRespDto();


        return retData;
    }

    /**
     * B1-1查询宿主类型菜单列表（平台）[862]
     * gen by moon at 8/10/2022, 3:42:26 AM
     */
    @Trace(operationName = "B1-1查询宿主类型菜单列表（平台）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryHostTypeMenuListRespDto queryHostTypeMenuList(BffQueryHostTypeMenuListReqDto reqDto) {


        QueryHostTypeListBorderRespDto queryHostTypeListBorderRespDto_1 = null;
//步骤0: D1-1查询宿主类型列表（边界） - queryHostTypeListBorder
        QueryHostTypeListBorderRespDto queryHostTypeListBorderRespDto = null;
        QueryHostTypeListBorderReqDto queryHostTypeListBorderReqDto = new QueryHostTypeListBorderReqDto();
        queryHostTypeListBorderReqDto.setCategoryTypeCode("PERSONAL");//sourceId:34301_1

        /*D1-1查询宿主类型列表（边界）[1423]   */
        Assert.isNull(queryHostTypeListBorderReqDto.getCategoryTypeCode(), "B1-1查询宿主类型菜单列表（平台）-D1-1查询宿主类型列表（边界）-宿主类型身份不能为空", false);
        queryHostTypeListBorderRespDto = fwBaseHostTypeClient.queryHostTypeListBorder(queryHostTypeListBorderReqDto).getData();

        queryHostTypeListBorderRespDto_1 = queryHostTypeListBorderRespDto;

        BffQueryHostTypeMenuListRespDto retData = new BffQueryHostTypeMenuListRespDto();
        if (queryHostTypeListBorderRespDto_1 != null) {
            retData.setHostTypeList(queryHostTypeListBorderRespDto_1.getHostTypeList().stream().map(item -> BeanUtil.toBean(item, BffHostTypeDto.class)).collect(Collectors.toList()));//sourceId:33653_1
        }


        return retData;
    }

    /**
     * B1-1查询宿主类型推荐列表（平台）[859]
     * gen by moon at 8/15/2022, 10:27:39 PM
     */
    @Trace(operationName = "B1-1查询宿主类型推荐列表（平台）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryHostTypeBizListRespDto queryHostTypeBizList(BffQueryHostTypeBizListReqDto reqDto) {


        QueryHostTypeListRespDto queryHostTypeListRespDto_1 = null;
        BatchQueryInductionRecordListComRespDto batchQueryInductionRecordListComRespDto_1 = null;
//步骤0: D1-1查询宿主类型列表 - queryHostTypeList
        QueryHostTypeListRespDto queryHostTypeListRespDto = null;
        QueryHostTypeListReqDto queryHostTypeListReqDto = new QueryHostTypeListReqDto();
        queryHostTypeListReqDto.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:34333_1
        queryHostTypeListReqDto.setPlatformData("TRUE");//sourceId:22518_1
        if (reqDto != null) {
            queryHostTypeListReqDto.setHostTypeName(reqDto.getHostTypeName());//sourceId:22513_1
            queryHostTypeListReqDto.setCategoryTypeCode(reqDto.getCategoryTypeCode());//sourceId:22515_1
            queryHostTypeListReqDto.setIsSystem(reqDto.getIsSystem());//sourceId:22519_1
            queryHostTypeListReqDto.setIsRecommend(reqDto.getIsRecommend());//sourceId:22523_1
        }

        /*D1-1查询宿主类型列表[839]   */
        Assert.isNull(queryHostTypeListReqDto.getSubjectLifeCycle(), "B1-1查询宿主类型推荐列表（平台）-D1-1查询宿主类型列表-主体生命周期不能为空", false);
        Assert.isNull(queryHostTypeListReqDto.getPlatformData(), "B1-1查询宿主类型推荐列表（平台）-D1-1查询宿主类型列表-是否平台数据不能为空", false);
        queryHostTypeListRespDto = fwBaseHostTypeClient.queryHostTypeList(queryHostTypeListReqDto).getData();

        queryHostTypeListRespDto_1 = queryHostTypeListRespDto;

//步骤1: D1-3批量查询就职记录列表（公共） - batchQueryInductionRecordListCom
        BatchQueryInductionRecordListComRespDto batchQueryInductionRecordListComRespDto = null;
        if (queryHostTypeListRespDto != null) {
            BatchQueryInductionRecordListComReqDto batchQueryInductionRecordListComReqDto = new BatchQueryInductionRecordListComReqDto();
            if (queryHostTypeListRespDto != null) {
                batchQueryInductionRecordListComReqDto.setPerOrgInductionRecordList(queryHostTypeListRespDto.getHostTypeList().stream().map(item -> item.getOperationInductionId())
                        .collect(Collectors.toList()));//sourceId:16717_1
            }

            /*D1-3批量查询就职记录列表（公共）[602]   */

            batchQueryInductionRecordListComRespDto = fwBaseInductionRecordClient.batchQueryInductionRecordListCom(batchQueryInductionRecordListComReqDto).getData();

            batchQueryInductionRecordListComRespDto_1 = batchQueryInductionRecordListComRespDto;
        }

        BffQueryHostTypeBizListRespDto retData = new BffQueryHostTypeBizListRespDto();
        //数据集融合
        if (queryHostTypeListRespDto_1 != null && !CollectionUtil.isEmpty(queryHostTypeListRespDto_1.getHostTypeList())) {
            for (HostTypeDto hostTypeDto : queryHostTypeListRespDto_1.getHostTypeList()) {
                BffHostTypeDto retElm = new BffHostTypeDto();
                if (queryHostTypeListRespDto_1 != null) {
                    retElm.setHostTypeId(hostTypeDto.getHostTypeId());//sourceId:8702_2
                    retElm.setHostTypeCode(hostTypeDto.getHostTypeCode());//sourceId:8703_2
                    retElm.setHostTypeName(hostTypeDto.getHostTypeName());//sourceId:8704_2
                    retElm.setIsRecommend(hostTypeDto.getIsRecommend());//sourceId:15526_2
                    retElm.setOperationInductionId(hostTypeDto.getOperationInductionId());//sourceId:15527_2
                    retElm.setOperateTime(hostTypeDto.getOperateTime());//sourceId:8707_2
                }
                retData.getHostTypeList().add(retElm);
                if (batchQueryInductionRecordListComRespDto_1 != null) {
                    for (PerOrgInductionRecordDto perOrgInductionRecordDto : batchQueryInductionRecordListComRespDto_1.getPerOrgInductionRecordList()) {
                        if (perOrgInductionRecordDto.getInductionRecordId().equals(hostTypeDto.getOperationInductionId())) {
                            if (batchQueryInductionRecordListComRespDto_1 != null) {
                                retElm.setUserId(perOrgInductionRecordDto.getUserId());//sourceId:38846_2
                                retElm.setUserFace(perOrgInductionRecordDto.getUserFace());//sourceId:38849_2
                                retElm.setIdCardName(perOrgInductionRecordDto.getIdCardName());//sourceId:38847_2
                                retElm.setNickName(perOrgInductionRecordDto.getNickName());//sourceId:38848_2
                            }
                        }
                    }
                }

            }
        }//sourceId:22603_1


        retData.setPageNum(queryHostTypeListRespDto.getPageNum());
        retData.setPageSize(queryHostTypeListRespDto.getPageSize());
        retData.setTotal(queryHostTypeListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryHostTypeListRespDto.getTotalNum()) / Double.valueOf(queryHostTypeListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B1-1查询宿主类型推荐的业务场景列表（平台）[858]
     * gen by moon at 8/26/2022, 3:13:34 PM
     */
    @Trace(operationName = "B1-1查询宿主类型推荐的业务场景列表（平台）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryHostTypeBizScnListRespDto queryHostTypeBizScnList(BffQueryHostTypeBizScnListReqDto reqDto) {


        QueryHostTypeBizScnListRespDto queryHostTypeBizScnListRespDto_1 = null;
        BatchQueryBizSceneRespDto batchQueryBizSceneRespDto_1 = null;
//步骤0: D1-1查询宿主类型推荐的业务场景列表 - queryHostTypeBizScnList
        QueryHostTypeBizScnListRespDto queryHostTypeBizScnListRespDto = null;
        QueryHostTypeBizScnListReqDto queryHostTypeBizScnListReqDto = new QueryHostTypeBizScnListReqDto();
        if (reqDto != null) {
            queryHostTypeBizScnListReqDto.setHostTypeId(reqDto.getHostTypeId());//sourceId:27845_1
            queryHostTypeBizScnListReqDto.setIsArchive(reqDto.getIsArchive());//sourceId:34382_1
        }

        /*D1-1查询宿主类型推荐的业务场景列表[860]   */
        Assert.isNull(queryHostTypeBizScnListReqDto.getHostTypeId(), "B1-1查询宿主类型推荐的业务场景列表（平台）-D1-1查询宿主类型推荐的业务场景列表-推荐的宿主类型ID不能为空", false);
        Assert.isNull(queryHostTypeBizScnListReqDto.getIsArchive(), "B1-1查询宿主类型推荐的业务场景列表（平台）-D1-1查询宿主类型推荐的业务场景列表-是否存档不能为空", false);
        queryHostTypeBizScnListRespDto = fwBaseHostTypeClient.queryHostTypeBizScnList(queryHostTypeBizScnListReqDto).getData();

        queryHostTypeBizScnListRespDto_1 = queryHostTypeBizScnListRespDto;

//步骤1: D1-1批量查业务场景 - batchQueryBizScene
        BatchQueryBizSceneRespDto batchQueryBizSceneRespDto = null;
        if (queryHostTypeBizScnListRespDto != null) {
            BatchQueryBizSceneReqDto batchQueryBizSceneReqDto = new BatchQueryBizSceneReqDto();
            if (queryHostTypeBizScnListRespDto != null) {
                batchQueryBizSceneReqDto.setBizSceneList(queryHostTypeBizScnListRespDto.getHostTypeBizScnList().stream().map(item -> item.getBizSceneId())
                        .collect(Collectors.toList()));//sourceId:33349_1
            }

            /*D1-1批量查业务场景[861]   */

            batchQueryBizSceneRespDto = fwBaseAppSceneClient.batchQueryBizScene(batchQueryBizSceneReqDto).getData();

            batchQueryBizSceneRespDto_1 = batchQueryBizSceneRespDto;
        }

        BffQueryHostTypeBizScnListRespDto retData = new BffQueryHostTypeBizScnListRespDto();
        //数据集融合
        if (queryHostTypeBizScnListRespDto_1 != null && !CollectionUtil.isEmpty(queryHostTypeBizScnListRespDto_1.getHostTypeBizScnList())) {
            for (HostTypeBizScnDto hostTypeBizScnDto : queryHostTypeBizScnListRespDto_1.getHostTypeBizScnList()) {
                BffHostTypeBizScnDto retElm = new BffHostTypeBizScnDto();
                if (queryHostTypeBizScnListRespDto_1 != null) {
                    retElm.setRecommendHostTypeRecordId(hostTypeBizScnDto.getRecommendHostTypeRecordId());//sourceId:15928_2
                    retElm.setBizSceneId(hostTypeBizScnDto.getBizSceneId());//sourceId:14947_2
                    retElm.setSubjectLifeCycle(hostTypeBizScnDto.getSubjectLifeCycle());//sourceId:14948_2
                    retElm.setIsArchive(hostTypeBizScnDto.getIsArchive());//sourceId:14949_2
                }
                retData.getHostTypeBizScnList().add(retElm);
                if (batchQueryBizSceneRespDto_1 != null) {
                    for (BizSceneDto bizSceneDto : batchQueryBizSceneRespDto_1.getBizSceneList()) {
                        if (bizSceneDto.getBizSceneId().equals(hostTypeBizScnDto.getBizSceneId())) {
                            if (batchQueryBizSceneRespDto_1 != null) {
                                retElm.setBizSceneName(bizSceneDto.getBizSceneName());//sourceId:14950_2
                                retElm.setBizAppId(bizSceneDto.getBizAppId());//sourceId:15573_2
                                retElm.setBizAppName(bizSceneDto.getBizAppName());//sourceId:15574_2
                            }
                        }
                    }
                }

            }
        }//sourceId:33351_1


        retData.setPageNum(queryHostTypeBizScnListRespDto.getPageNum());
        retData.setPageSize(queryHostTypeBizScnListRespDto.getPageSize());
        retData.setTotal(queryHostTypeBizScnListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryHostTypeBizScnListRespDto.getTotalNum()) / Double.valueOf(queryHostTypeBizScnListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B1-1新增宿主类型推荐到业务场景（平台）[857]
     * gen by moon at 10/25/2022, 10:01:10 AM
     */
    @Trace(operationName = "B1-1新增宿主类型推荐到业务场景（平台）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffAddHostTypeBizScnRespDto addHostTypeBizScn(BffAddHostTypeBizScnReqDto reqDto) {


        AddHostTypeBizScnRespDto addHostTypeBizScnRespDto_1 = null;
//步骤0: D1-1新增宿主类型推荐到业务场景 - addHostTypeBizScn
        AddHostTypeBizScnRespDto addHostTypeBizScnRespDto = null;
        AddHostTypeBizScnReqDto addHostTypeBizScnReqDto = new AddHostTypeBizScnReqDto();
        if (reqDto != null) {
            addHostTypeBizScnReqDto.setHostTypeId(reqDto.getHostTypeId());//SimpleFieldAssign//sourceId:34356_1
            addHostTypeBizScnReqDto.setBizSceneId(reqDto.getBizSceneId());//SimpleFieldAssign//sourceId:34357_1
            addHostTypeBizScnReqDto.setBizSenceCode(reqDto.getBizSenceCode());//SimpleFieldAssign//sourceId:34358_1
            addHostTypeBizScnReqDto.setBizAppCode(reqDto.getBizAppCode());//SimpleFieldAssign//sourceId:388732_1
            addHostTypeBizScnReqDto.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:34362_1
        }

        /*D1-1新增宿主类型推荐到业务场景[854]   */
        Assert.isNull(addHostTypeBizScnReqDto.getHostTypeId(), "B1-1新增宿主类型推荐到业务场景（平台）-D1-1新增宿主类型推荐到业务场景-推荐的宿主类型ID不能为空", false);
        Assert.isNull(addHostTypeBizScnReqDto.getBizSceneId(), "B1-1新增宿主类型推荐到业务场景（平台）-D1-1新增宿主类型推荐到业务场景-业务场景ID不能为空", false);
        Assert.isNull(addHostTypeBizScnReqDto.getBizSenceCode(), "B1-1新增宿主类型推荐到业务场景（平台）-D1-1新增宿主类型推荐到业务场景-业务场景编码不能为空", false);
        Assert.isNull(addHostTypeBizScnReqDto.getBizAppCode(), "B1-1新增宿主类型推荐到业务场景（平台）-D1-1新增宿主类型推荐到业务场景-业务应用标识不能为空", false);
        Assert.isNull(addHostTypeBizScnReqDto.getSubjectLifeCycle(), "B1-1新增宿主类型推荐到业务场景（平台）-D1-1新增宿主类型推荐到业务场景-主体生命周期不能为空", false);
        addHostTypeBizScnRespDto = fwBaseHostTypeClient.addHostTypeBizScn(addHostTypeBizScnReqDto).getData();


        addHostTypeBizScnRespDto_1 = addHostTypeBizScnRespDto;

        BffAddHostTypeBizScnRespDto retData = new BffAddHostTypeBizScnRespDto();
        if (addHostTypeBizScnRespDto_1 != null) {
            retData.setRecommendHostTypeRecordId(addHostTypeBizScnRespDto_1.getRecommendHostTypeRecordId());//SimpleFieldAssign//sourceId:34368_1
        }


        return retData;
    }

    /**
     * B1-1修改宿主类型（平台）[847]
     * gen by moon at 8/10/2022, 3:42:13 AM
     */
    @Trace(operationName = "B1-1修改宿主类型（平台）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffUpdateHostTypeRespDto updateHostType(BffUpdateHostTypeReqDto reqDto) {


        //步骤0: D1-1修改宿主类型 - updateHostType
        UpdateHostTypeRespDto updateHostTypeRespDto = null;
        UpdateHostTypeReqDto updateHostTypeReqDto = new UpdateHostTypeReqDto();
        if (reqDto != null) {
            updateHostTypeReqDto.setHostTypeId(reqDto.getHostTypeId());//sourceId:22356_1
            updateHostTypeReqDto.setHostTypeCode(reqDto.getHostTypeCode());//sourceId:22357_1
            updateHostTypeReqDto.setHostTypeName(reqDto.getHostTypeName());//sourceId:22358_1
            updateHostTypeReqDto.setCategoryTypeCode(reqDto.getCategoryTypeCode());//sourceId:22359_1
            updateHostTypeReqDto.setHostSurfaceCode(reqDto.getHostSurfaceCode());//sourceId:22360_1
            updateHostTypeReqDto.setHostInputFieldCode(reqDto.getHostInputFieldCode());//sourceId:22361_1
            updateHostTypeReqDto.setIsSystem(reqDto.getIsSystem());//sourceId:22362_1
            updateHostTypeReqDto.setInputTypeCode(reqDto.getInputTypeCode());//sourceId:22363_1
            updateHostTypeReqDto.setInputSurfaceCode(reqDto.getInputSurfaceCode());//sourceId:22364_1
            updateHostTypeReqDto.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:22365_1
        }

        /*D1-1修改宿主类型[842]   */
        Assert.isNull(updateHostTypeReqDto.getHostTypeId(), "B1-1修改宿主类型（平台）-D1-1修改宿主类型-宿主类型ID不能为空", false);
        updateHostTypeRespDto = fwBaseHostTypeClient.updateHostType(updateHostTypeReqDto).getData();


        BffUpdateHostTypeRespDto retData = new BffUpdateHostTypeRespDto();


        return retData;
    }

    /**
     * B1-1新增宿主类型（平台）[846]
     * gen by moon at 10/11/2022, 6:09:58 PM
     */
    @Trace(operationName = "B1-1新增宿主类型（平台）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffAddHostTypeRespDto addHostType(BffAddHostTypeReqDto reqDto) {


        AddHostTypeRespDto addHostTypeRespDto_1 = null;
//步骤0: D1-1新增宿主类型 - addHostType
        AddHostTypeRespDto addHostTypeRespDto = null;
        AddHostTypeReqDto addHostTypeReqDto = new AddHostTypeReqDto();
        addHostTypeReqDto.setPlatformData("TRUE");//sourceId:34319_1
        if (reqDto != null) {
            addHostTypeReqDto.setHostTypeCode(reqDto.getHostTypeCode());//SimpleFieldAssign//sourceId:22338_1
            addHostTypeReqDto.setHostTypeName(reqDto.getHostTypeName());//SimpleFieldAssign//sourceId:22339_1
            addHostTypeReqDto.setCategoryTypeCode(reqDto.getCategoryTypeCode());//SimpleFieldAssign//sourceId:22340_1
            addHostTypeReqDto.setHostSurfaceCode(reqDto.getHostSurfaceCode());//SimpleFieldAssign//sourceId:23774_1
            addHostTypeReqDto.setHostInputFieldCode(reqDto.getHostInputFieldCode());//SimpleFieldAssign//sourceId:23775_1
            addHostTypeReqDto.setInputTypeCode(reqDto.getInputTypeCode());//SimpleFieldAssign//sourceId:23776_1
            addHostTypeReqDto.setInputSurfaceCode(reqDto.getInputSurfaceCode());//SimpleFieldAssign//sourceId:23777_1
            addHostTypeReqDto.setIsSystem(reqDto.getIsSystem());//SimpleFieldAssign//sourceId:22343_1
            addHostTypeReqDto.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:22346_1
        }

        /*D1-1新增宿主类型[841]   */
        Assert.isNull(addHostTypeReqDto.getHostTypeCode(), "B1-1新增宿主类型（平台）-D1-1新增宿主类型-宿主类型编码不能为空", false);
        Assert.isNull(addHostTypeReqDto.getHostTypeName(), "B1-1新增宿主类型（平台）-D1-1新增宿主类型-宿主类型名称不能为空", false);
        Assert.isNull(addHostTypeReqDto.getCategoryTypeCode(), "B1-1新增宿主类型（平台）-D1-1新增宿主类型-宿主类型身份不能为空", false);
        Assert.isNull(addHostTypeReqDto.getIsSystem(), "B1-1新增宿主类型（平台）-D1-1新增宿主类型-是否系统类型不能为空", false);
        Assert.isNull(addHostTypeReqDto.getPlatformData(), "B1-1新增宿主类型（平台）-D1-1新增宿主类型-是否平台数据不能为空", false);
        Assert.isNull(addHostTypeReqDto.getSubjectLifeCycle(), "B1-1新增宿主类型（平台）-D1-1新增宿主类型-主体生命周期不能为空", false);
        addHostTypeRespDto = fwBaseHostTypeClient.addHostType(addHostTypeReqDto).getData();


        addHostTypeRespDto_1 = addHostTypeRespDto;

        BffAddHostTypeRespDto retData = new BffAddHostTypeRespDto();
        if (addHostTypeRespDto_1 != null) {
            retData.setHostTypeId(addHostTypeRespDto_1.getHostTypeId());//SimpleFieldAssign//sourceId:28311_1
        }


        return retData;
    }

    /**
     * B1-1查询宿主类型详情（平台）[845]
     * gen by moon at 8/10/2022, 3:42:11 AM
     */
    @Trace(operationName = "B1-1查询宿主类型详情（平台）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryHostTypeDetailRespDto queryHostTypeDetail(BffQueryHostTypeDetailReqDto reqDto) {


        QueryHostTypeDetailRespDto queryHostTypeDetailRespDto_1 = null;
        QueryInductionRecordInfoDetailComRespDto queryInductionRecordInfoDetailComRespDto_1 = null;
//步骤0: D1-1查询宿主类型详情 - queryHostTypeDetail
        QueryHostTypeDetailRespDto queryHostTypeDetailRespDto = null;
        QueryHostTypeDetailReqDto queryHostTypeDetailReqDto = new QueryHostTypeDetailReqDto();
        if (reqDto != null) {
            queryHostTypeDetailReqDto.setHostTypeId(reqDto.getHostTypeId());//sourceId:22381_1
        }

        /*D1-1查询宿主类型详情[840]   */
        Assert.isNull(queryHostTypeDetailReqDto.getHostTypeId(), "B1-1查询宿主类型详情（平台）-D1-1查询宿主类型详情-宿主类型ID不能为空", false);
        queryHostTypeDetailRespDto = fwBaseHostTypeClient.queryHostTypeDetail(queryHostTypeDetailReqDto).getData();

        queryHostTypeDetailRespDto_1 = queryHostTypeDetailRespDto;

//步骤1: D1-3查询个人就职记录信息详情（公共） - queryInductionRecordInfoDetailCom
        QueryInductionRecordInfoDetailComRespDto queryInductionRecordInfoDetailComRespDto = null;
        if (queryHostTypeDetailRespDto != null) {
            QueryInductionRecordInfoDetailComReqDto queryInductionRecordInfoDetailComReqDto = new QueryInductionRecordInfoDetailComReqDto();
            if (queryHostTypeDetailRespDto != null) {
                queryInductionRecordInfoDetailComReqDto.setInductionRecordId(queryHostTypeDetailRespDto.getOperationInductionId());//sourceId:16694_1
            }

            /*D1-3查询个人就职记录信息详情（公共）[715]   */
            Assert.isNull(queryInductionRecordInfoDetailComReqDto.getInductionRecordId(), "B1-1查询宿主类型详情（平台）-D1-3查询个人就职记录信息详情（公共）-就职记录ID不能为空", false);
            queryInductionRecordInfoDetailComRespDto = fwBaseInductionRecordClient.queryInductionRecordInfoDetailCom(queryInductionRecordInfoDetailComReqDto).getData();

            queryInductionRecordInfoDetailComRespDto_1 = queryInductionRecordInfoDetailComRespDto;
        }

        BffQueryHostTypeDetailRespDto retData = new BffQueryHostTypeDetailRespDto();
        if (queryHostTypeDetailRespDto_1 != null) {
            retData.setHostTypeId(queryHostTypeDetailRespDto_1.getHostTypeId());//sourceId:22394_1
            retData.setHostTypeCode(queryHostTypeDetailRespDto_1.getHostTypeCode());//sourceId:22395_1
            retData.setHostTypeName(queryHostTypeDetailRespDto_1.getHostTypeName());//sourceId:22396_1
            retData.setCategoryTypeCode(queryHostTypeDetailRespDto_1.getCategoryTypeCode());//sourceId:22397_1
            retData.setHostSurfaceCode(queryHostTypeDetailRespDto_1.getHostSurfaceCode());//sourceId:22398_1
            retData.setHostInputFieldCode(queryHostTypeDetailRespDto_1.getHostInputFieldCode());//sourceId:22399_1
            retData.setInputTypeCode(queryHostTypeDetailRespDto_1.getInputTypeCode());//sourceId:22400_1
            retData.setInputSurfaceCode(queryHostTypeDetailRespDto_1.getInputSurfaceCode());//sourceId:22401_1
            retData.setIsSystem(queryHostTypeDetailRespDto_1.getIsSystem());//sourceId:34313_1
            retData.setPlatformData(queryHostTypeDetailRespDto_1.getPlatformData());//sourceId:34312_1
            retData.setIsRecommend(queryHostTypeDetailRespDto_1.getIsRecommend());//sourceId:34314_1
            retData.setIsFreeze(queryHostTypeDetailRespDto_1.getIsFreeze());//sourceId:34315_1
            retData.setTempFreezeStatus(queryHostTypeDetailRespDto_1.getTempFreezeStatus());//sourceId:34316_1
            retData.setIsArchive(queryHostTypeDetailRespDto_1.getIsArchive());//sourceId:34317_1
            retData.setSubjectLifeCycle(queryHostTypeDetailRespDto_1.getSubjectLifeCycle());//sourceId:22402_1
            retData.setOperationInductionId(queryHostTypeDetailRespDto_1.getOperationInductionId());//sourceId:28075_1
            retData.setOperateTime(queryHostTypeDetailRespDto_1.getOperateTime());//sourceId:22404_1
        }
        if (queryInductionRecordInfoDetailComRespDto_1 != null) {
            retData.setUserId(queryInductionRecordInfoDetailComRespDto_1.getUserId());//sourceId:34304_1
            retData.setUserFace(queryInductionRecordInfoDetailComRespDto_1.getUserFace());//sourceId:22409_1
            retData.setIdCardName(queryInductionRecordInfoDetailComRespDto_1.getIdCardName());//sourceId:22407_1
            retData.setNickName(queryInductionRecordInfoDetailComRespDto_1.getNickName());//sourceId:34305_1
        }


        return retData;
    }

    /**
     * B1查询业务场景下宿主类型列表(管理)[5007]
     * gen by moon at 11/7/2022, 11:50:33 PM
     */
    @Trace(operationName = "B1查询业务场景下宿主类型列表(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryBizSceneHostTypeListRespDto queryBizSceneHostTypeList(BffQueryBizSceneHostTypeListReqDto reqDto) {


        QueryBizSceneHostTypeListRespDto queryBizSceneHostTypeListRespDto_1 = null;
        BatchQueryInductionRecordComRespDto batchQueryInductionRecordComRespDto_1 = null;
//步骤0: D1查询业务场景下宿主类型列表 - queryBizSceneHostTypeList
        QueryBizSceneHostTypeListRespDto queryBizSceneHostTypeListRespDto = null;
        QueryBizSceneHostTypeListReqDto queryBizSceneHostTypeListReqDto = new QueryBizSceneHostTypeListReqDto();
        if (reqDto != null) {
            queryBizSceneHostTypeListReqDto.setBizSenceCode(reqDto.getBizSenceCode());//SimpleFieldAssign//sourceId:388776_1
            queryBizSceneHostTypeListReqDto.setBizAppCode(reqDto.getBizAppCode());//SimpleFieldAssign//sourceId:388777_1
            queryBizSceneHostTypeListReqDto.setCategoryTypeCode(reqDto.getCategoryTypeCode());//SimpleFieldAssign//sourceId:388778_1
            queryBizSceneHostTypeListReqDto.setPlatformData(reqDto.getPlatformData());//SimpleFieldAssign//sourceId:388779_1
            queryBizSceneHostTypeListReqDto.setIsSystem(reqDto.getIsSystem());//SimpleFieldAssign//sourceId:388780_1
            queryBizSceneHostTypeListReqDto.setIsRecommend(reqDto.getIsRecommend());//SimpleFieldAssign//sourceId:388781_1
        }

        /*D1查询业务场景下宿主类型列表[5005]   */
        Assert.isNull(queryBizSceneHostTypeListReqDto.getIsRecommend(), "B1查询业务场景下宿主类型列表(管理)-D1查询业务场景下宿主类型列表-是否推荐不能为空", false);
        queryBizSceneHostTypeListRespDto = fwBaseHostTypeClient.queryBizSceneHostTypeList(queryBizSceneHostTypeListReqDto).getData();


        queryBizSceneHostTypeListRespDto_1 = queryBizSceneHostTypeListRespDto;

//步骤1: D1-3批量查询就职记录(管理)(公共) - batchQueryInductionRecordCom
        BatchQueryInductionRecordComRespDto batchQueryInductionRecordComRespDto = null;
        if (queryBizSceneHostTypeListRespDto != null) {
            BatchQueryInductionRecordComReqDto batchQueryInductionRecordComReqDto = new BatchQueryInductionRecordComReqDto();
            if (queryBizSceneHostTypeListRespDto != null) {
                batchQueryInductionRecordComReqDto.setOrgInductionRecordList(queryBizSceneHostTypeListRespDto.getHostTypeList().stream().map(item -> item.getOperationInductionId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:422375_1
            }

            /*D1-3批量查询就职记录(管理)(公共)[5024]   */

            batchQueryInductionRecordComRespDto = fwBaseInductionRecordClient.batchQueryInductionRecordCom(batchQueryInductionRecordComReqDto).getData();


            batchQueryInductionRecordComRespDto_1 = batchQueryInductionRecordComRespDto;
        }

        BffQueryBizSceneHostTypeListRespDto retData = new BffQueryBizSceneHostTypeListRespDto();
        //数据集融合  MoreListToOneSource
        if (queryBizSceneHostTypeListRespDto_1 != null && !CollectionUtil.isEmpty(queryBizSceneHostTypeListRespDto_1.getHostTypeList())) {
            for (HostTypeDto hostTypeDto : queryBizSceneHostTypeListRespDto_1.getHostTypeList()) {
                BffBizSceneHostTypeDto retElm = new BffBizSceneHostTypeDto();
                if (queryBizSceneHostTypeListRespDto_1 != null) {
                    retElm.setHostTypeId(hostTypeDto.getHostTypeId());//SimpleFieldAssign//sourceId:110445_2
                    retElm.setHostTypeCode(hostTypeDto.getHostTypeCode());//SimpleFieldAssign//sourceId:110444_2
                    retElm.setHostTypeName(hostTypeDto.getHostTypeName());//SimpleFieldAssign//sourceId:110446_2
                    retElm.setIsRecommend(hostTypeDto.getIsRecommend());//SimpleFieldAssign//sourceId:110447_2
                    retElm.setOperationInductionId(hostTypeDto.getOperationInductionId());//SimpleFieldAssign//sourceId:110448_2
                    retElm.setOperateTime(hostTypeDto.getOperateTime());//SimpleFieldAssign//sourceId:110449_2
                }
                retData.getBizSceneHostTypeList().add(retElm);
                if (batchQueryInductionRecordComRespDto_1 != null) {
                    for (OrgInductionRecordDto orgInductionRecordDto : batchQueryInductionRecordComRespDto_1.getOrgInductionRecordList()) {
                        if (orgInductionRecordDto.getInductionRecordId().equals(hostTypeDto.getOperationInductionId())) {
                            if (batchQueryInductionRecordComRespDto_1 != null) {
                                retElm.setUserId(orgInductionRecordDto.getUserId());//SimpleFieldAssign//sourceId:115619_2
                                retElm.setUserFace(orgInductionRecordDto.getUserFace());//SimpleFieldAssign//sourceId:115620_2
                                retElm.setIdCardName(orgInductionRecordDto.getIdCardName());//SimpleFieldAssign//sourceId:115621_2
                                retElm.setNickName(orgInductionRecordDto.getNickName());//SimpleFieldAssign//sourceId:115622_2
                            }
                        }
                    }
                }

            }
        }//sourceId:388789_1


        return retData;
    }

    /**
     * B1-1删除宿主类型推荐的业务场景(管理)[5038]
     * gen by moon at 10/28/2022, 8:54:30 PM
     */
    @Trace(operationName = "B1-1删除宿主类型推荐的业务场景(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffDeleteHostTypeBizScnRespDto deleteHostTypeBizScn(BffDeleteHostTypeBizScnReqDto reqDto) {


        //步骤0: D1-1删除宿主类型推荐的业务场景 - deleteHostTypeBizScn
        DeleteHostTypeBizScnRespDto deleteHostTypeBizScnRespDto = null;
        DeleteHostTypeBizScnReqDto deleteHostTypeBizScnReqDto = new DeleteHostTypeBizScnReqDto();
        if (reqDto != null) {
            deleteHostTypeBizScnReqDto.setRecommendHostTypeRecordId(reqDto.getRecommendHostTypeRecordId());//SimpleFieldAssign//sourceId:407181_1
        }

        /*D1-1删除宿主类型推荐的业务场景[5037]   */
        Assert.isNull(deleteHostTypeBizScnReqDto.getRecommendHostTypeRecordId(), "B1-1删除宿主类型推荐的业务场景(管理)-D1-1删除宿主类型推荐的业务场景-推荐宿主类型记录ID不能为空", false);
        deleteHostTypeBizScnRespDto = fwBaseHostTypeClient.deleteHostTypeBizScn(deleteHostTypeBizScnReqDto).getData();


        BffDeleteHostTypeBizScnRespDto retData = new BffDeleteHostTypeBizScnRespDto();


        return retData;
    }
    //
}
